#include "playvedio.h"
#include "ui_playvedio.h"

playVedio::playVedio(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::playVedio)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_ShowModal,true);
    setWindowIcon(QIcon(":/images/homePage/logo.png"));
    connect(ui->minBtn,&QPushButton::clicked,this,&QWidget::showMinimized);
    connect(ui->quitBtn,&QPushButton::clicked,this,&QWidget::close);
}

playVedio::~playVedio()
{
    delete ui;
}

void playVedio::mousePressEvent(QMouseEvent *event)
{
    QPoint point = event->position().toPoint();
    if(ui->playHeader->geometry().contains(point))
    {
        if(event->button()==Qt::LeftButton)
        {
            drags=event->globalPosition().toPoint() - this->geometry().topLeft();
            return;
        }
    }

    QWidget::mousePressEvent(event);
}

void playVedio::mouseMoveEvent(QMouseEvent *event)
{
    QPoint point = event->position().toPoint();
    if(ui->playHeader->geometry().contains(point))
    {
        if(event->buttons()==Qt::LeftButton)
        {
            this->move(event->globalPosition().toPoint()-drags);
            return;
        }
    }

    QWidget::mouseMoveEvent(event);
}
